<?php
    include_once($_SERVER['DOCUMENT_ROOT']."/htqlmba/configs/database.php");
   
    class taikhoan extends database{
        private $tendv;
        private $matkhau;
        private $quyen;
		private $madv;
		
		public function setmadv($madv){
            $this->madv = $madv;
        }
        public function getmadv(){
            return $this->madv;
        }
		
        public function settendv($tendv){
            $this->tendv = $tendv;
        }
        public function gettendv(){
            return $this->tendv;
        }
        public function setmatkhau($matkhau){
            $this->matkhau = $matkhau;
        }
        public function getmatkhau(){
            return $this->matkhau;
        }
        public function setquyen($quyen){
            $this->quyen = $quyen;
        }
         public function getquyen(){
            return $this->quyen;
        }
        public function themtaikhoan(){
            $this->setQuery("insert into tai_khoan(TEN_TK,MAT_KHAU,QUYEN) values ('".$this->gettendv()."','".$this->getmatkhau()."','".$this->getquyen()."')");
            return $this->executeQuery();
        }
        public function suataikhoan(){
            $this->setQuery("update tai_khoan set MAT_KHAU='".$this->getmatkhau()."',QUYEN='".$this->getquyen()."' where TEN_TK='".$this->gettendv()."'");
			// echo $this->getQuery();
            return $this->executeQuery();
        }
         public function xoataikhoan(){
            $this->setQuery("delete from tai_khoan where TEN_TK='".$this->gettendv()."'");
            return $this->executeQuery();
        }
        public function kiemTra(){
            return $this->isExits("tai_khoan","TEN_TK='". $this->tendv."' and MAT_KHAU = '".$this->matkhau."'");
            //$this->getQuery();
        }
        public function ganQuyen(){
            if ($this->kiemTra()!=0){
                while ($rows = mysql_fetch_array($this->getResult())){
                    $this->setquyen($rows['QUYEN']);               
               } 
            }
            
        }
        	
   }
?>